<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:64:"D:\phpStudy\WWW\auth/application/adminmall\view\agent\index.html";i:1496201809;s:64:"D:\phpStudy\WWW\auth/application/adminmall\view\public\base.html";i:1496201810;}*/ ?>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<title>高级管理员</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<!--[if lt IE 9]>
    	<meta http-equiv="refresh" content="0;ie.html" />
    	<![endif]-->
		<link rel="shortcut icon" href="favicon.ico">
		<link href="__CSS__/bootstrap.min.css" rel="stylesheet">
		<link href="__CSS__/font-awesome.min.css" rel="stylesheet">
		<link href="__CSS__/animate.min.css" rel="stylesheet">
		<link href="__CSS__/style.min.css" rel="stylesheet">
		<link href="__CSS__/admin.css" rel="stylesheet">
	</head>
	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<div id="wrapper">
			<!--左侧导航开始-->
			<nav class="navbar-default navbar-static-side" role="navigation">
				<div class="nav-close"><i class="fa fa-times-circle"></i>
				</div>
				<div class="sidebar-collapse">
					<ul class="nav" id="side-menu">
						<li class="nav-header" style="height: 60px;padding: 0; text-align: center;line-height: 60px; color: #FFFFFF; font-size: 20px; ">
                               <strong><?php echo session('admin_name'); ?></strong>
						</li>
						<?php if(!empty($menu)): if(is_array($menu) || $menu instanceof \think\Collection): if( count($menu)==0 ) : echo "" ;else: foreach($menu as $key=>$vo): ?>
						<li class="menu">
							<a href="<?php echo $vo['name']; ?>">
								<i class="<?php echo $vo['icon']; ?>"></i>
								<span class="nav-label"><?php echo $vo['title']; ?> </span>
								<span class="fa arrow"></span>
							</a>
							<ul class="nav nav-second-level">
								<?php if(!empty($vo['children'])): if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection): if( count($vo['children'])==0 ) : echo "" ;else: foreach($vo['children'] as $key=>$v): ?>
								<li>
									<a href="<?php echo url($v['name']); ?>"><?php echo $v['title']; ?></a>
								</li>
								<?php endforeach; endif; else: echo "" ;endif; endif; ?>
							</ul>
						</li>
						<?php endforeach; endif; else: echo "" ;endif; endif; ?>
					</ul>
				</div>
			</nav>
			<!--左侧导航结束-->
			<!--右侧部分开始-->
			<div id="page-wrapper" class="gray-bg dashbard-1">
				<div class="row border-bottom">
					<nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
						<div class="navbar-header">
							<a class="navbar-minimalize minimalize-styl-2 btn btn-primary" href="#">
								<i class="fa fa-bars"></i>
							</a>
						</div>
						<ul class="nav navbar-top-links navbar-left">
							<li class="hidden-xs" id='shouye'>
							<a href="<?php echo url('admin/index/index'); ?>">
								&nbsp;&nbsp;<i class="fa fa-home"></i>首页&nbsp;&nbsp;
							</a>
							</li>
							<li class="hidden-xs">
								<a href=<?php echo url('adminmall/UnionStore/index'); ?>>
									<i class="fa fa-users"></i>联盟商家</a>
							</li>
							<li>
								<a href=<?php echo url('adminmall/ConsMember/index',array('active'=>1)); ?>><i class="fa fa-user"></i>合伙人</a>
							</li>
							<li>
								<a href=<?php echo url('admin/Member/index',array('active'=>2)); ?>><i class="fa fa-user-plus"></i>加盟商申请</a>
							</li>
							<li>
								<a href=<?php echo url('adminmall/Scorec/index',array('active'=>3)); ?>><i class="fa fa-yen"></i>提现申请</a>
							</li>
							<li>
								<a href=<?php echo url('adminmall/Order/index',array('active'=>6)); ?>><i class="fa fa-shopping-cart"></i>订单管理</a>
							</li>
						</ul>
						<ul class="nav navbar-top-links navbar-right">
							<li class="hidden-xs">
								<a href="<?php echo url('system/clear'); ?>">
									<i class="fa fa-refresh"></i>清除缓存
								</a>
							</li>
							<li class="hidden-xs">
								<a href="<?php echo url('login/logout'); ?>"><i class="fa fa-sign-out"></i>退出系统</a>
							</li>
						</ul>
					</nav>
				</div>
				<div class="row">
					
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="<?php echo url('index/index'); ?>"><i class="fa fa-home"></i></a>
		</li>
		<li><strong>商家列表</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="<?php echo url('index'); ?>">
          	<div class="form-group">
      			商户性质 <select class="bank" name="store_property">
                <option value="0">商家类型</option>
                <option value="1">个人</option>
                <option value="2">商家</option>
                <option value="3">工厂</option>
            	</select>
        		商户类型 <select class="bank" name="agent_type">
 				<option value="0">商户类型</option>
                <option value="1">普通商家</option>
                <option value="2">加盟商</option>
            	</select>
         		行业类型 <select name="license" class="bank">
				<option value="0">行业分类</option>
				<?php if(is_array($tralist) || $tralist instanceof \think\Collection): if( count($tralist)==0 ) : echo "" ;else: foreach($tralist as $key=>$vo): ?>
				<option value="<?php echo $vo['id']; ?>">
					<?php echo $vo['title']; ?>
				</option>
				<?php endforeach; endif; else: echo "" ;endif; ?>
				</select>
				是否有证件 <select class="bank" name="is_credentials">
 				<option value="0">请选择</option>
                <option value="1">有</option>
                <option value="2">无</option>
           	 	</select>
    			保证金 <select class="bank" name="is_foregift">
 				<option value="2">请选择</option>
                <option value="1">已缴纳</option>
                <option value="0">未缴纳</option>
            	</select><br/>
   				是否分销 <select class="bank" name="is_distribution">
 				<option value="2">请选择</option>
                <option value="1">开启</option>
                <option value="0">关闭</option>
            	</select>
      			附近显示 <select class="bank" name="is_display">
 				<option value="2">请选择</option>
                <option value="1">开启</option>
                <option value="0">关闭</option>
            	</select>
       			审核状态 <select class="bank" name="status">
 				<option value="0">请选择</option>
                <option value="1">正常</option>
                <option value="2">未审核</option>
            	</select>
    			&nbsp;&nbsp;&nbsp;创建时间
    			<input id='start_time' name='start_time'  style="width: 170px;" onclick='WdatePicker()' type='text' placeholder="开始时间" class="bank" />
				至<input id='end_time' name='end_time'  style="width: 170px;" onclick='WdatePicker()' type='text' placeholder="结束时间" class="bank" />	
				<br/>商户名称 <input type="text" name='store_name' placeholder="请输入商家名称" class="bank"> 
				<span class="bank"><button type="submit" class="btn btn-sm btn-primary"> <li class="fa fa-search"> 搜索</li></button> </span>
            </div>
           
	       	
        </form>
		<div class="hr-line-dashed"></div>
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                            	<th>用户id</th>
                                <th>商户名</th>
                                <th>商户类型</th>
                                <th>行业</th>
                                <th>商品数量</th>
                                <th>证件</th>
                                <th>保证金</th>
                                <th>是否分销</th>
                                <th>是否附近显示</th>
                                <th>余额</th>
								<th>积分</th>
                                <th>联系电话</th>
                                <th>审核状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="list">
                        	<?php if(is_array($list) || $list instanceof \think\Collection): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$ad): $mod = ($i % 2 );++$i;?>
                        	<tr>
								<td><?php echo $ad['u_id']; ?></td>
                        		<td><a href="<?php echo url('agentinfo',['id'=>$ad['id']]); ?>" ><?php echo $ad['store_name']; ?></a></td>
                        		<td>
                        			<?php if($ad['agent_type'] == 1): ?>
                        			普通商家
                        			<br />
                        		<a href="<?php echo url('examine',['id'=>$ad['id']]); ?>" class="btn btn-primary bnt-sm ajax-do">
								升级</a>
                        			<?php else: ?>
                        			加盟商	
                        			<?php endif; ?>
                        		</td>
                        		<td><?php echo $ad['title']; ?></td>
                        		<td>
                        			0
                        		</td>
                        		<td class="text-center">
                        			<?php if($ad['is_credentials'] == 1): ?>
                        			是
                        			<?php else: ?>
                        			否	
                        			<?php endif; ?>
                        		</td>
                        		<td class="text-center">
                        			<?php echo $ad['foregift_money']; ?></br>
                        			<?php if($ad['is_foregift'] == 1): ?>
                        			是
                        			<?php else: ?>
                        			否	
                        			<?php endif; ?>
                        		</td>
                        		<td> 
	                        		<div class="onoffswitch">
	                                <input type="checkbox" data-id="<?php echo $ad['id']; ?>" onclick="update_dis(this)" value="<?php echo $ad['is_distribution']; ?>" id="is_distribution<?php echo $ad['id']; ?>" name="is_distribution<?php echo $ad['id']; ?>" <?php if($ad['is_distribution']): ?>checked<?php endif; ?> class="onoffswitch-checkbox" >
	                                <label class="onoffswitch-label" for="is_distribution<?php echo $ad['id']; ?>">
	                                    <span class="onoffswitch-inner"></span>
	                                    <span class="onoffswitch-switch"></span>
	                                </label>
	                        		</div>
                        		</td>
                        		<td>
                            		<div class="onoffswitch">
	                                <input type="checkbox" onclick="update_xs(this)" class="onoffswitch-checkbox" value="<?php echo $ad['is_display']; ?>" data-id="<?php echo $ad['id']; ?>" id="is_display<?php echo $ad['id']; ?>"  name="is_display<?php echo $ad['id']; ?>" <?php if($ad['is_display']): ?>checked<?php endif; ?> >
                                	<label class="onoffswitch-label" for="is_display<?php echo $ad['id']; ?>">
	                                    <span class="onoffswitch-inner"></span>
	                                    <span class="onoffswitch-switch"></span>
                            		</label>
                            		</div>
                        		</td>
                        		<td><?php echo $ad['store_balance']; ?><br />
                        		<input type="button" value="充值" id="credit2"class="btn btn-primary bnt-sm" onclick="chongzhi(<?php echo $ad['id']; ?>,1)">
                        		</td>
                        		<td><?php echo $ad['score']; ?><br />
                        		<input type="button" value="充值" id="credit1"class="btn btn-primary bnt-sm" onclick="chongzhi(<?php echo $ad['id']; ?>,2)">
                        		</td>
                        		<td><?php echo $ad['store_tel']; ?></td>
                        		<td class="text-center">
                        			<?php if($ad['status'] == 1): ?>
                        			 审核通过
                        			<?php elseif($ad['status'] == 2): ?>
                        			<a href="<?php echo url('toexamine',['id'=>$ad['id']]); ?>" class="btn btn-danger bnt-sm ajax-do">
										<i class="fa fa-paste"></i> 未审核</a>
                        			<?php endif; ?>
                        		</td>
                        		<td>                 			
									<?php if($ad['store_state'] == 2): ?>
									<a href="<?php echo url('frozen',['id'=>$ad['id'], 'status'=>$ad['store_state']]); ?>" class="btn btn-primary bnt-sm ajax-do">
									<i class="fa fa-unlock"></i> 激活</a>
                        			<?php elseif($ad['store_state'] == 1): ?>
                        			<a href="<?php echo url('frozen',['id'=>$ad['id'], 'status'=>$ad['store_state']]); ?>" class="btn btn-danger bnt-sm ajax-do">
									<i class="fa fa-lock"></i> 冻结</a>                  			
                        			<?php endif; ?>
									<a href="<?php echo url('chainlist',['id'=>$ad['id']]); ?>" class="btn btn-primary bnt-sm">
									<i class="fa fa-paste"></i> 连锁店</a>
                        		</td>
                        	</tr>
                        	<?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                    <div style="text-align: right;">
                      <?php echo $list->render(); ?>
                    </div>
                </div>
            </div>
            </div>
</div>

				</div>
			</div>
			<!--右侧部分结束-->
		</div>
		<div class="footer">
			<div class="pull-right"> 版权所有CMS Project &copy; 2017-2020 版权所有</div>
		</div>
		<script src="__JS__/jquery.min.js"></script>
		<script src="__JS__/bootstrap.min.js"></script>
		<script src="__JS__/jquery.metisMenu.js"></script>
		<script src="__JS__/jquery.slimscroll.min.js"></script>
		<script src="__LIB__/layer/layer.js"></script>
		<script src="__JS__/core.min.js"></script>
		<script src="__JS__/pace.min.js"></script>
		<script src="__JS__/help.js"></script>
		<script>
			// 文件上传URL
			var __UPLOAD_URL__ = "<?php echo url('admin/upload/index'); ?>";
			var __CURRENT_URL__ = "<?php echo $current_url; ?>";
		</script>
		<script src="__JS__/admin.js"></script>
		<script>
			var show="<?php echo $is_show_left; ?>";
			if(show==0){
				$("body").toggleClass("mini-navbar"), SmoothlyMenu();
			}
		</script>
		
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/datepicker/WdatePicker.js"></script>
<script>
	function update_dis(obj){
		var value = $(obj).val();
		var chk=$(obj).is(':checked');
			$.ajax({
				type:"post",
				data:{id:$(obj).data("id"),is_distribution:value==1?0:1},
				url:"update_agent",
				success:function(data){
					layer.msg(data.msg);
					if(data.code==200){
						$(obj).val(value==1?0:1);
					}
				}
			});
	}
	function update_xs(obj){
		var value = $(obj).val();
		var chk=$(obj).is(':checked');
			$.ajax({
				type:"post",
				data:{id:$(obj).data("id"),is_display:value==1?0:1},
				url:"update_agent",
				success:function(data){
					layer.msg(data.msg);
					if(data.code==200){
						$(obj).val(value==1?0:1);
					}
				}
			});
	}
	/**
     * 商家充值
     * @param int    $page
     * @return mixed
     */
    public function chongzhi() {
    	if(input("type")==1)else
		if ($res) {
        	return json(["code"=>200,'msg'=>'充值成功']);
        } else {
            return json(["code"=>406,'msg'=>'充值失败']);
        }
    }
</script>
<style>
.bank{
	width: 150px;
    height:30px;
    border-radius:5px;
}
</style>

	</body>

</html>